<template>
  <div class="contain-datatopShow">
    <div class="box-card-info" @click="clickInfo(0)">
      <el-card>
        <div class="data-num">
          <!-- 图标 -->
          <div>
            <i class="el-icon-user icon-font"></i>
          </div>
          <!-- 数据 -->
          <div>
            <div class="font-title">今日问答</div>
            <div class="font-cnt">{{ info.dailyQuestionsNumber }}</div>
            <div class="font-title">总问答数</div>
            <div class="font-cnt">{{ info.questionsNumber }}</div>
          </div>
        </div>
      </el-card>
    </div>
    <div class="box-card-info" @click="clickInfo(1)">
      <el-card>
        <div class="data-num">
          <!-- 图标 -->
          <div>
            <i class="el-icon-thumb icon-font"></i>
          </div>
          <!-- 数据 -->
          <div>
            <div class="font-title">用户总数</div>
            <div class="font-cnt">{{ info.usersNumber }}</div>
            <div class="font-title">今日访问</div>
            <div class="font-cnt">{{ info.visitsNumber }}</div>
          </div>
        </div>
      </el-card>
    </div>
    <div class="box-card-info" @click="clickInfo(2)">
      <el-card>
        <div class="data-num">
          <!-- 图标 -->
          <div>
            <i class="el-icon-medal icon-font"></i>
          </div>
          <!-- 数据 -->
          <div>
            <div class="font-title">会员总数</div>
            <div class="font-cnt">{{ info.allVipNumbers }}</div>
            <div class="font-title">超级会员</div>
            <div class="font-cnt">{{ info.allSuperVipNumbers }}</div>
          </div>
        </div>
      </el-card>
    </div>
  </div>
</template>

<script>
import { getKanBan } from '@/api/dashboard'
export default {
  name: 'dataTopShow',
  data() {
    return {
      info: {
        usersNumber: '加载中...',
        visitsNumber: '加载中...',
        questionsNumber: '加载中...',
        allVipNumbers: '加载中...',
        allSuperVipNumbers: '加载中...',
        dailyQuestionsNumber: '加载中...'
      }
    }
  },
  methods: {
    clickInfo(item) {
      console.log(item)
      this.$emit('checkEchart', item)
    },
    getKanBan() {
      getKanBan().then(res => {
        if(res.code !== 200) {
          return
        }
        this.info = res.data
        console.log(this.info)

      })
    }
  },
  mounted() {
    this. getKanBan()
  }
}
</script>

<style>
.font-center {
  padding: 20px;
}
.gap {
  margin-bottom: 50px;
}
.contain-datatopShow {
  display: flex;
  justify-content: space-between;
}
.box-card-info {
  /* min-width: 200px; */
  margin: 0 20px;
  width: 100%;
}
.font-title {
  color: #8C8C8C;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.font-cnt {
  color: #666666;
  font-size: 16px;
  font-weight: 700;
  margin: 12px;
}
.icon-font {
  font-size: 50px;
  color: #40C9C6;
  padding: 20px;
  border-radius: 5px;
  transition: all 0.3s;
}
.data-num {
  cursor: pointer;
}
.data-num:hover .icon-font {
  color: white;
  background: #40C9C6;
}

.data-num {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}
</style>